/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
/* Copyright (C) 2012 Zongyou Yao. All rights reserved.     */

#ifndef ATOM_INCLUDED
#define ATOM_INCLUDED

/**
 * It is a checked runtime error to pass a null str to any atom function. It is an
 * unchecked runtime error to modify an atom.
 */

/**
 * Returns the length of the atom str. It is a checked runtime error for str not to
 * be an atom.
 */
int atom_length(const char *str);

/**
 * Returns the atom for str[0 .. len - 1], creating one if necessary. It is a
 * checked runtime error for len < 0.
 * Exception mem_failed can be raised.
 */
const char * atom_new(const char *str, int len);

/**
 * Returns atom_new(str, strlen(str)).
 * Exception mem_failed can be raised.
 */
const char * atom_string(const char *str);

/**
 * Returns the atom for the decimal string representation of n.
 * Exception mem_failed can be raised.
 */
const char * atom_int(long n);

#endif
